package cn.com.wangluotongxin.chat.model.constants;

public enum UserOnlineStatus {

    OFF(0, "离线"),
    ON(1, "在线");

    private Integer code;
    public Integer getCode(){
        return this.code;
    }

    private String name;
    public  String getName(){
        return this.name;
    }

    public static UserOnlineStatus getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            UserOnlineStatus[] userOnlineStatuses = values();
            for(UserOnlineStatus userOnlineStatus : userOnlineStatuses){
                if(userOnlineStatus.getCode().equals(code)){
                    return userOnlineStatus;
                }
            }
        }
        return null;
    }

    UserOnlineStatus(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
